//
//  UILabel+Extension.swift
//  微博
//
//  Created by liuerying on 16/5/23.
//  Copyright © 2016年 liuerying. All rights reserved.
//

import UIKit

//给UILabel 添加一个便利的构造函数
extension UILabel{
//遍历的构造函数
    convenience init(title: String?,font:CGFloat,textcolor:UIColor,alignment:NSTextAlignment = .Center){
        //调用指定的构造函数,实例化对象
        self.init()
        self.text = title
        self.font = UIFont.systemFontOfSize(font)
        self.textColor = textcolor
        textAlignment = alignment

        
        if alignment == .Left{
        
            //设置最大布局的宽度
            preferredMaxLayoutWidth = ScreeWidth - 2*StatusCellMargin
            
        }
        //设置自动换行
        numberOfLines = 0
        //自适应大小
        sizeToFit()
        
    }
}